﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <link href="css/bootstrap.css" rel="stylesheet" />
    <link href="css/site.css" rel="stylesheet" />
    <script src="js/vue.js"></script>
    <script src="js/axios.js"></script>
    <script src="js/beetlex4axios.js"></script>
    <script src="js/component.js"></script>
    <title>Beetlex samples</title>

</head>
<body>
    <div id="page">
        <page-header>

        </page-header>
        <div class="container" style="margin-top:60px;">
            <div class="row">
                <form class="form-inline">
                    <div class="form-group">
                        <label class="sr-only" for="exampleInputEmail3">雇员</label>
                        <select v-model="orders.data.employee">
                            <option value="">All</option>
                            <option v-for="item in employees.result" :value="item.EmployeeID">
                                {{item.FirstName}} {{item.LastName}}
                            </option>
                        </select>
                    </div>
                    <button type="button" class="btn btn-default btn-sm" @click="orders.get()">查询</button>
                </form>
            </div>
            <div class="row">

                <table class="table">

                    <thead>
                        <tr>
                            <th>#</th>
                            <th>CustomerID</th>
                            <th>ShipName</th>
                            <th>OrderDate</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="(item,i) in orders.result">
                            <th scope="row">{{i}}</th>
                            <td>{{item.CustomerID}}</td>
                            <td>{{item.ShipName}}</td>
                            <td>{{item.OrderDate}}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <script>
        var employees = new beetlexAction("/Employees", null, []);
        var orders = new beetlexAction("/Orders", { employee: '' }, []);
        var model = {
            selected:'',
            employees: employees,
            orders: orders,
        };

        var page = new Vue({
            el: '#page',
            data: model,
            methods: {

            }
        });
        employees.get();
    </script>
</body>

</html>